Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] add build ci for other platforms, use read_bytes for terminate of x86_64-pc-oslab #196

Merged
merged 1 commit into from
Oct 30, 2024

Conversation

hky1999
Copy link
Contributor

@hky1999 hky1999 commented Oct 29, 2024

fix the bug introduced by #195

getchar is required by x86_64-pc-oslab platform in modules/axhal/src/platform/x86_pc/misc.rs

/// Shutdown the whole system (in QEMU), including all CPUs.
///
/// See <https://wiki.osdev.org/Shutdown> for more information.
pub fn terminate() -> ! {
    info!("Shutting down...");

    #[cfg(platform = "x86_64-pc-oslab")]
    {
        axlog::ax_println!("System will reboot, press any key to continue ...");
        while super::console::getchar().is_none() {}
        axlog::ax_println!("Rebooting ...");
        unsafe { PortWriteOnly::new(0x64).write(0xfeu8) };
    }
}

also I re-introduced build-for-other-platforms, because this bug is found by the ci test from arceos-apps, I think it should be the arceos itself that is responsible for it

@equation314
Copy link
Member

We should make the API list consistent across all platforms. So add putchar /getchar for all platforms, or use console_read_bytes for x86_64-pc-oslab

@hky1999
Copy link
Contributor Author

hky1999 commented Oct 30, 2024

We should make the API list consistent across all platforms. So add putchar /getchar for all platforms, or use console_read_bytes for x86_64-pc-oslab

I'll just use read_bytes, like this

    #[cfg(platform = "x86_64-pc-oslab")]
    {
        axlog::ax_println!("System will reboot, press any key to continue ...");
        let mut buffer = [0u8; 1];
        while super::console::read_bytes(&buffer) == 0 {}
        axlog::ax_println!("Rebooting ...");
        unsafe { PortWriteOnly::new(0x64).write(0xfeu8) };
    }

equation314
equation314 previously approved these changes Oct 30, 2024
@equation314
Copy link
Member

What's wrong with CI?

@hky1999 hky1999 changed the title [fix] make getchar in x86 platform pub, add build ci for other platforms [fix] add build ci for other platforms, use read_bytes for terminate of x86_64-pc-oslab Oct 30, 2024
@hky1999
Copy link
Contributor Author

hky1999 commented Oct 30, 2024

What's wrong with CI?

It seems to be a github internal error, i do not know why

@hky1999 hky1999 merged commit 49ca581 into main Oct 30, 2024
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants